include("maps.lua")


GM.ContentPrefix = "../addons/sourceforts/"
GM.DownloadsEnabled = false 

local function AddResourceDirectory(Directory, Types)

	for k,v in pairs(file.Find(GM.ContentPrefix.."/"..Directory.."/*")) do

		local File = Directory.."/"..v

		if v != "_svn" && v != ".svn" then

			if file.IsDir(GM.ContentPrefix.."/"..File) then
				AddResourceDirectory(File, Types)
			else
				local ext = string.GetExtensionFromFilename(v)
				
				if table.HasValue(Types, ext) then
					resource.AddFile( string.lower( File ) )
				end
			end

		end

	end

end

--AddResourceDirectory("maps", {"bsp"})
AddResourceDirectory("materials/sf", {"vmt", "vtf"})
AddResourceDirectory("materials/skybox", {"vmt", "vtf"})
AddResourceDirectory("materials/sf194", {"vmt", "vtf"})
AddResourceDirectory("materials/buildwall", {"vmt", "vtf"})
AddResourceDirectory("materials/models", {"vmt", "vtf"})

print("MAP: ", string.lower( game.GetMap( ) ))

local map = string.lower( game.GetMap( ) )

if map == "sf_skywalk" then
	AddResourceDirectory("materials/valley", {"vmt", "vtf"})
	AddResourceDirectory("materials/Canyon", {"vmt", "vtf"})
	AddResourceDirectory("materials/Optical", {"vmt", "vtf"})
end

AddResourceDirectory("models", {"mdl"})
AddResourceDirectory("particles", {"pcf"})
AddResourceDirectory("sound", {"wav", "mp3"})
